package com.gen.method;

import java.util.List;

import com.framework.persist.dbmaper.DBParseFactory;
import com.framework.persist.dbmaper.IDBToBeanParse;

import freemarker.template.SimpleScalar;
import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModelException;

public class GetFieldNameMethodModel implements TemplateMethodModel {
	private IDBToBeanParse parse = DBParseFactory.getParse();

	@SuppressWarnings("rawtypes")
	public Object exec(List arguments) throws TemplateModelException {
		if (arguments.size() != 1) {
			throw new TemplateModelException("Wrong arguments");
		}
		return new SimpleScalar(this.parse.getFieldName((String) arguments.get(0)));
	}
}